package com.dy.project.domain;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 貨物清單模板
 */
public class CommodityOrderTemplate {
    /** 訂單id */
    private Long comId;
    /** 訂單編號 */
    private String comNo;
    /** 商品名稱 */
    private String acName;
    /** 囚犯編號 */
    private String dtStaffNo;
    /** 囚犯姓名 */
    private String dtName;
    /** 囚倉資料 */
    private String dtDtoNo;
    /** 訂單總金額（確認金額） */
    private Double orderTotal;
    /** 訂單狀態 */
    private Integer comState;
    /** 商品类型id组 */
    private List<Integer> actIds;
    /** 下單時間 */
    @JsonFormat(pattern = "yyyy/MM/dd")
    private Date createTime;
    /** 查詢開始時間 */
    @JsonIgnore
    private String beginTime;
    /** 查詢結束時間 */
    @JsonIgnore
    private String endTime;
    /** 请求参数 */
    @JsonIgnore
    private Map<String, Object> params;
    /** 请求参数JSON字符串 */
    @JsonIgnore
    private String paramsStr;

    public Long getComId() {
        return comId;
    }

    public void setComId(Long comId) {
        this.comId = comId;
    }

    public String getAcName() {
        return acName;
    }

    public void setAcName(String acName) {
        this.acName = acName;
    }

    public String getComNo() {
        return comNo;
    }

    public void setComNo(String comNo) {
        this.comNo = comNo;
    }

    public String getDtStaffNo() {
        return dtStaffNo;
    }

    public void setDtStaffNo(String dtStaffNo) {
        this.dtStaffNo = dtStaffNo;
    }

    public String getDtName() {
        return dtName;
    }

    public void setDtName(String dtName) {
        this.dtName = dtName;
    }

    public String getDtDtoNo() {
        return dtDtoNo;
    }

    public void setDtDtoNo(String dtDtoNo) {
        this.dtDtoNo = dtDtoNo;
    }

    public Double getOrderTotal() {
        return orderTotal;
    }

    public void setOrderTotal(Double orderTotal) {
        this.orderTotal = orderTotal;
    }

    public Integer getComState() {
        return comState;
    }

    public void setComState(Integer comState) {
        this.comState = comState;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(String beginTime) {
        this.beginTime = beginTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public List<Integer> getActIds() {
        return actIds;
    }

    public void setActIds(List<Integer> actIds) {
        this.actIds = actIds;
    }
    public Map<String, Object> getParams()
    {
        if (params == null)
        {
            params = new HashMap<>();
        }
        return params;
    }

    public void setParams(Map<String, Object> params) {
        this.params = params;
    }

    public String getParamsStr() {
        return paramsStr;
    }

    public void setParamsStr(String paramsStr) {
        this.paramsStr = paramsStr;
        JSONObject jo = JSONObject.parseObject(paramsStr);
        this.params = (Map<String,Object>)JSONObject.toJavaObject(jo,Map.class);
    }

    @Override
    public String toString() {
        return "CommodityOrderTemplate{" +
                "comId=" + comId +
                ", comNo='" + comNo + '\'' +
                ", acName='" + acName + '\'' +
                ", dtStaffNo='" + dtStaffNo + '\'' +
                ", dtName='" + dtName + '\'' +
                ", dtDtoNo='" + dtDtoNo + '\'' +
                ", orderTotal=" + orderTotal +
                ", comState=" + comState +
                ", actIds=" + actIds +
                ", createTime=" + createTime +
                ", beginTime='" + beginTime + '\'' +
                ", endTime='" + endTime + '\'' +
                ", params=" + params +
                ", paramsStr='" + paramsStr + '\'' +
                '}';
    }
}
